home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / puma.lha / puma / src / Scanner.rpp < prev    next >
Text File  |  1992-09-25  |  2KB  |  110 lines

  1. m
  2. TYPE
  3. yyIdent = RECORD Ident: tIdent; END;
  4. yyOperator = RECORD Ident: tIdent; END;
  5. yyIncOperator = RECORD Ident: tIdent; END;
  6. yyTargetBlock = RECORD Text: tText; END;
  7. yyString = RECORD StringRef: tStringRef; END;
  8. yyNumber = RECORD StringRef: tStringRef; END;
  9. yyTargetCode = RECORD StringRef: tStringRef; END;
  10. yyWhiteSpace = RECORD StringRef: tStringRef; END;
  11. (* '::' *) yy9 = RECORD StringRef: tStringRef; END;
  12.  
  13. tScanAttribute = RECORD
  14. Position: tPosition;
  15. CASE : SHORTCARD OF
  16. | 1: Ident: yyIdent;
  17. | 2: Operator: yyOperator;
  18. | 3: IncOperator: yyIncOperator;
  19. | 4: TargetBlock: yyTargetBlock;
  20. | 5: String: yyString;
  21. | 6: Number: yyNumber;
  22. | 7: TargetCode: yyTargetCode;
  23. | 8: WhiteSpace: yyWhiteSpace;
  24. | 9: (* '::' *) yy9: yy9;
  25. END; END;
  26.  
  27. PROCEDURE ErrorAttribute (Token: INTEGER; VAR pAttribute: tScanAttribute);
  28. %%
  29. PROCEDURE ErrorAttribute (Token: INTEGER; VAR pAttribute: tScanAttribute);
  30. BEGIN
  31.  pAttribute.Position := Attribute.Position;
  32.  CASE Token OF
  33.  | (* Ident *) 1: 
  34.  pAttribute.Ident.Ident    := NoIdent    ;
  35.  ;
  36.  | (* Operator *) 2: 
  37.  pAttribute.Operator.Ident    := NoIdent    ;
  38.  ;
  39.  | (* IncOperator *) 3: 
  40.  pAttribute.IncOperator.Ident    := NoIdent    ;
  41.  ;
  42.  | (* TargetBlock *) 4: 
  43.  MakeText (pAttribute.TargetBlock.Text); ;
  44.  ;
  45.  | (* String *) 5: 
  46.  pAttribute.String.StringRef    := GetStringRef (NoIdent);
  47.  ;
  48.  | (* Number *) 6: 
  49.  pAttribute.Number.StringRef    := GetStringRef (NoIdent);
  50.  ;
  51.  | (* TargetCode *) 7: 
  52.  pAttribute.TargetCode.StringRef    := GetStringRef (NoIdent);
  53.  ;
  54.  | (* WhiteSpace *) 8: 
  55.  pAttribute.WhiteSpace.StringRef    := GetStringRef (NoIdent);
  56.  ;
  57.  | (* '::' *) 9: 
  58.  pAttribute.yy9.StringRef    := GetStringRef (NoIdent);
  59.  ;
  60.  ELSE
  61.  END;
  62. END ErrorAttribute;
  63. %%
  64. 1 S Ident Ident
  65. 2 S Operator Operator
  66. 3 S IncOperator IncOperator
  67. 4 S TargetBlock TargetBlock
  68. 5 S String String
  69. 6 S Number Number
  70. 7 S TargetCode TargetCode
  71. 8 S WhiteSpace WhiteSpace
  72. 9 S yy9 '::'
  73. 10 N TRAFO TRAFO
  74. 11 N 'TREE' 'TREE'
  75. 12 N ',' ','
  76. 13 N PUBLIC PUBLIC
  77. 14 N EXTERN EXTERN
  78. 15 N ';' ';'
  79. 16 N 'EXPORT' 'EXPORT'
  80. 17 N 'IMPORT' 'IMPORT'
  81. 18 N 'GLOBAL' 'GLOBAL'
  82. 19 N 'BEGIN' 'BEGIN'
  83. 20 N 'CLOSE' 'CLOSE'
  84. 21 N PROCEDURE PROCEDURE
  85. 22 N '(' '('
  86. 23 N REF REF
  87. 24 N ':' ':'
  88. 25 N '.' '.'
  89. 26 N '[' '['
  90. 27 N ']' ']'
  91. 28 N '=>' '=>'
  92. 29 N ')' ')'
  93. 30 N 'LOCAL' 'LOCAL'
  94. 31 N '..' '..'
  95. 32 N NIL NIL
  96. 33 N '_' '_'
  97. 34 N '{' '{'
  98. 35 N '}' '}'
  99. 36 N '->' '->'
  100. 37 N '^' '^'
  101. 38 N ':>' ':>'
  102. 39 N ':=' ':='
  103. 40 N '?' '?'
  104. 41 N REJECT REJECT
  105. 42 N FAIL FAIL
  106. 43 N NL NL
  107. 44 N RETURN RETURN
  108. 45 N 'FUNCTION' 'FUNCTION'
  109. 46 N PREDICATE PREDICATE
  110.